Socket
Socket
Sign inDemoInstall

turf-variance

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-variance

turf variance module


Version published
Weekly downloads
65
increased by30%
Maintainers
8
Weekly downloads
 
Created
Source

turf-variance

build status

turf variance module

turf.variance(polygons, points, inField, outField)

Calculates the variance value of a field for Point features within a set of Polygon features.

Parameters

parametertypedescription
polygonsFeatureCollectiona FeatureCollection of Polygon features
pointsFeatureCollectiona FeatureCollection of Point features
inFieldstringthe field in input data to analyze
outFieldstringthe field in which to store results

Example

var polygons = turf.featurecollection([
  turf.polygon([[
    [-97.414398, 37.684092],
    [-97.414398, 37.731353],
    [-97.332344, 37.731353],
    [-97.332344, 37.684092],
    [-97.414398, 37.684092]
  ]]),
  turf.polygon([[
    [-97.333717, 37.606072],
    [-97.333717, 37.675397],
    [-97.237586, 37.675397],
    [-97.237586, 37.606072],
    [-97.333717, 37.606072]
  ]])
]);
var points = turf.featurecollection([
  turf.point([-97.401351, 37.719676], {population: 200}),
  turf.point([-97.355346, 37.706639], {population: 600}),
  turf.point([-97.387962, 37.70012], {population: 100}),
  turf.point([-97.301788, 37.66507], {population: 200}),
  turf.point([-97.265052, 37.643325], {population: 300})]);

var aggregated = turf.variance(
  polygons, points, 'population', 'variance');

var result = turf.featurecollection(
  points.features.concat(aggregated.features));

//=result

Installation

Requires nodejs.

$ npm install turf-variance

Tests

$ npm test

Keywords

FAQs

Package last updated on 06 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc